#ifndef SLOG2_CONTEXT_H_
#define SLOG2_CONTEXT_H_

#include <sys/slog2.h>
#include <string>
#include "common.h"

class Slog2Context final {
  public:
    Slog2ReturnValue Initialize(
		    const std::string contextid,
		    const std::string description,
		    Slog2VerbosityLevel verbosity);

    Slog2ReturnValue Register();

    Slog2ReturnValue Unregister();

    bool IsConsoleEnabled();
    Slog2ReturnValue EnableConsole(bool enable);

    bool IsRemoteEnabled();
    Slog2ReturnValue EnableRemote(bool enable);

    slog2_buffer_t GetDefaultBuffer();

  private:
    uint8_t toVerbosity(Slog2VerbosityLevel verbosity_level);

    std::string contextid_;
    std::string description_;
    Slog2VerbosityLevel verbosity_;
    bool console_enabled_{false};
    bool remote_enabled_{false};

    slog2_buffer_set_config_t config_;
    slog2_buffer_t handle_;
};

#endif //SLOG2_CONTEXT_H_
